//
//  GlobalMacro.h
//  IMHuanXin
//
//  Created by 小獾科技 on 2017/7/26.
//  Copyright © 2017年 小獾科技. All rights reserved.
//

#ifndef GlobalMacro_h
#define GlobalMacro_h
#define NSLog(FORMAT, ...) fprintf(stderr, "%s:%zd\t%s\n", [[[NSString stringWithUTF8String: __FILE__] lastPathComponent] UTF8String], __LINE__, [[NSString stringWithFormat: FORMAT, ## __VA_ARGS__] UTF8String])//解决xcode打印不全的问题
#define GW_Domain                  @"https://clubbear.clubbear.cn"//域名
#define NetWork                    [BaseNetwork new]



//字体样式
#define IMAGE(objc)             [UIImage imageNamed:objc]
#define FONTSIZE(size)          [UIFont systemFontOfSize:size]

//PingFangSC-Semibold
#define NORFONT(s)          [UIFont systemFontOfSize:s] // 系统字体
#define NORBFONT(s)         [UIFont boldSystemFontOfSize:s] // 系统字体
#define PFRFONT(s)          iOS9?[UIFont fontWithName:@"PingFangSC-Regular" size:s]:[UIFont systemFontOfSize:s]   // PingFangSC-Regular
#define PFMFONT(s)          iOS9?[UIFont fontWithName:@"PingFangSC-Semibold" size:s]:[UIFont boldSystemFontOfSize:s]    // PingFangSC-Medium


// 格式化字符串
#define STRING(_obj)           ([GW_Tool formatString:_obj])
#define ISEMPTYSTRING(_obj)    ([GW_Tool isEmptyString:_obj])

// 设备相关
#define iOSVer                ([[UIDevice currentDevice] systemVersion])// 字符串
#define iOS8                  ([[[UIDevice currentDevice] systemVersion] doubleValue] >= 8.0)// 布尔值
#define iOS9                  ([[[UIDevice currentDevice] systemVersion] doubleValue] >= 9.0)// 布尔值
#define iOS10                 ([[[UIDevice currentDevice] systemVersion] doubleValue] >= 10.0)// 布尔值
#define iOS11                 ([[[UIDevice currentDevice] systemVersion] doubleValue] >= 11.0)// 布尔值

//bundle id
#define BUNDLE_ID               [[NSBundle mainBundle] bundleIdentifier]

// 当前版本号
#define APP_VERSION           [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]

#define G_UUID                [GW_Tool getDeviceIDFA]

//高宽
#define GWIDTH                [UIScreen mainScreen].bounds.size.width
#define GHEIGHT               [UIScreen mainScreen].bounds.size.height

#define IS_IPHONE5            [UIScreen mainScreen].bounds.size.width == 320
#define IS_IPHONE6            [UIScreen mainScreen].bounds.size.width == 375 //6 6s 7 7s
#define IS_IPHONE_PLUS        [UIScreen mainScreen].bounds.size.width == 414


// 颜色 from 16进制
#define ColorFrom16(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define ColorFrom16A(rgbValue, alphaValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:alphaValue]

// 颜色 from RGB
#define ColorFromRGB(r,g,b)     [UIColor colorWithRed:(r / 255.0) green:(g / 255.0) blue:(b / 255.0) alpha:1.0]
#define ColorFromRGBA(r,g,b,a)  [UIColor colorWithRed:(r / 255.0) green:(g / 255.0) blue:(b / 255.0) alpha:(a)]
#define ColorClear              [UIColor clearColor]
#define ColorWhite              [UIColor whiteColor]
#define ColorBlack              [UIColor blackColor]
#define ColorGreen              [UIColor greenColor]
#define ColorRed                [UIColor redColor]
#define ColorYellow             [UIColor yellowColor]
#define ColorCyan               [UIColor cyanColor]



// APP颜色
#define COLOR_FOR_STYLE         ColorFrom16(0xF9BC4F)               // 整体风格 - 橙色
#define COLOR_FOR_NAVI          ColorFrom16(0xFFFFFF)               // 导航条颜色 - 白色
#define COLOR_FOR_NAVI_TITLE    ColorFrom16(0x4A4A4A)               // 导航条字体颜色
#define COLOR_FOR_NAVI_TINT     COLOR_FOR_STYLE                     // 导航条图标颜色
#define COLOR_FOR_TABBAR        ColorFrom16(0xFFFFFF)               // Tabbar背景颜色
#define COLOR_FOR_BAR_TINT      COLOR_FOR_STYLE                     // Tabbar tint
#define COLOR_FOR_BAR_TEXT_NOR  ColorFrom16(0x646464)               // Tabbar正常文字颜色
#define COLOR_FOR_BAR_TEXT_SEL  COLOR_FOR_STYLE                     // Tabbar高亮文字颜色
#define COLOR_FOR_VC_BG         ColorFrom16(0xF9F9F9)               // 页面背景颜色 浅灰色
#define COLOR_FOR_IMAGE_BG      ColorFrom16(0xF8F8F8)               // 图片默认图背景颜色 浅灰色
#define COLOR_LINE              ColorFrom16(0xE2E2E2)               // 线条
#define COLOR_FOR_TEXT_4A       ColorFrom16(0x4A4A4A)               // 黑色字体4A
#define COLOR_FOR_TEXT_64       ColorFrom16(0x646464)               // 黑色字体64

#define COLOR_BACKGROUND        ColorFrom16(0xeef4f7)               //背景颜色


// Toast
#define MESSAGE_TOAST(msg)\
{   [SVProgressHUD showWithOnlyStatus:msg];}
#define SUCCESS_TOAST {[SVProgressHUD showSuccess];}

// 公共提示语
//#define NetErrorToastText       [GlobalData sharedInstance].noNetwork?@"当前没有网络":@"出错了"    // 网络错误
#define TimeoutErrorToastText   @"请求超时"
#define UnknownErrorToastText   @"未知错误"

#define weakobj(object) autoreleasepool{} __weak __typeof__(object) weak##_##object = object;
#define strongobj(object) autoreleasepool{} __typeof__(object) object = weak##_##object;


// 用户信息
#define IS_LOGIN            [[NSUserDefaults standardUserDefaults] boolForKey:kUDIsLogin]
#define USER_OPEN_ID        STRING([[NSUserDefaults standardUserDefaults] objectForKey:kUDUserOpenId])
#define USER_UNION_ID       STRING([[NSUserDefaults standardUserDefaults] objectForKey:kUDUserUnionId])
#define USER_TEL            STRING([[NSUserDefaults standardUserDefaults] objectForKey:kUDUserTel])
#define USER_HEAD           STRING([[NSUserDefaults standardUserDefaults] objectForKey:kUDUserHead])
#define USER_NAME           STRING([[NSUserDefaults standardUserDefaults] objectForKey:kUDUName])//用户名称
#define USER_TOKEN          STRING([[NSUserDefaults standardUserDefaults] objectForKey:kUDUserToken])
#define BABY_BIRTHDAY       STRING([[NSUserDefaults standardUserDefaults] objectForKey:kUDBabyBirthday])
#define BABYSEX             STRING([[NSUserDefaults standardUserDefaults] objectForKey:kUDBabySex])
#define TOKEN               STRING([[NSUserDefaults standardUserDefaults] objectForKey:kUDtoken])
#define BABYNAME            STRING([[NSUserDefaults standardUserDefaults] objectForKey:kUDBabyName])//宝宝姓名
#define USER_VIP            STRING([[NSUserDefaults standardUserDefaults] objectForKey:kUDVip])//vip
#define USER_BALANCE        [[NSUserDefaults standardUserDefaults] objectForKey:kUDBalance]//钱
#define USER_AGE            STRING([[NSUserDefaults standardUserDefaults] objectForKey:kUDAge])//岁数

#define CITYNAME            [[NSUserDefaults standardUserDefaults] objectForKey:kCityName]//城市名称
#endif /* GlobalMacro_h */
